import request, { post, put } from '@/utils/request'

const api = {
  BASE_URL: '/system/urls',
}

export function getList(parameter) {
  return request({
    url: api.BASE_URL,
    method: 'get',
    params: parameter,
  })
}

export function create(parameter) {
  return post(api.BASE_URL, parameter, {
    headers: {
      'Content-Type': 'application/json;utf-8',
    },
  })
}

export function update(parameter) {
  const id = parameter.id
  return put(api.BASE_URL + '/' + parameter.id, parameter, {
    headers: {
      'Content-Type': 'application/json',
    },
  })
}

export function deleteUrl(parameter) {
  const id = parameter.id
  const url = api.BASE_URL + `/${id}`
  return request({
    url: url,
    method: 'delete',
  })
}
